package com.codeforces.contest.c300;

import java.math.BigInteger;
import java.util.Scanner;

public class _300C {

	static Scanner scanner = new Scanner(System.in);
	static final int MOD = 1000000007;
	static int a, b, n, sum;
	static long count = 0;

	public static void main(String[] args) {
		a = scanner.nextInt();
		b = scanner.nextInt();
		n = scanner.nextInt();
		for (int i=0;i<=n;++i) {
			sum = i*a + (n-i)*b;
			if (valid(sum)) {
				count = (count + bino(n,Math.max(i, n-i))) % MOD;
			}
		}
		System.out.println(count);
	}

	private static long bino(int n, int m) {
		long down = 1;
		long up = 1;
		long idx = m + 1;
		for (long i=1;i<=n-m;++i) {
			down = (down * i) % MOD;
			up = (up * idx) % MOD;
			idx++;
		}
		BigInteger mod = new BigInteger(MOD + "");
		BigInteger d = new BigInteger(down + "").modInverse(mod);
		up = (up * d.longValue()) % MOD;
		return up;
	}

	private static boolean valid(int num) {
		while (num > 0) {
			int re = num % 10;
			num /= 10;
			if (re == a || re == b) {
				continue;
			}
			else {
				return false;
			}
		}
		return true;
	}

}
